using RuoVea.ExDto;
using RuoVea.ExEnum;
using RuoVea.ExSugar.Attributes;
using RuoVea.ExSugar.Entity;
using SqlSugar;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

namespace RuoVea.OmiApi.Log.Entitys;

/// <summary>
/// 操作日志表
/// </summary>
[SugarTable(nameof(SysLogOp), "操作日志表")]
[Description("操作日志表")]
[Tenant("0")]
public class SysLogOp : AutoKeyBase, ITenantEntity
{
    /// <summary>
    /// 租户Id
    /// </summary>
    [ConfigSugarTenantColumn("TenantId", "租户Id", false, true, false)]
    public long? TenantId { get; set; }
    /// <summary>
    /// 名称
    /// </summary>
    [MaxLength(100)]
    [ConfigSugarColumn(columnKey: nameof(Name), columnDescription:"名称", IsNullable = true)]
    public string Name { get; set; }

    /// <summary>
    /// 是否执行成功（Y-是，N-否）
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(Success), columnDescription:"是否执行成功", IsNullable = true)]
    public YesOrNot Success { get; set; }

    /// <summary>
    /// 具体消息
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(Message), columnDescription:"具体消息", IsNullable = true, ColumnDataType = StaticConfig.CodeFirst_BigString)]
    public string Message { get; set; }

    /// <summary>
    /// IP
    /// </summary>
    [MaxLength(20)]
    [ConfigSugarColumn(columnKey: nameof(Ip), columnDescription:"IP", IsNullable = true)]
    public string Ip { get; set; }

    /// <summary>
    /// 地址
    /// </summary>
    [MaxLength(500)]
    [ConfigSugarColumn(columnKey: nameof(Location), columnDescription:"地址", IsNullable = true)]
    public string Location { get; set; }

    /// <summary>
    /// 浏览器
    /// </summary>
    [MaxLength(100)]
    [ConfigSugarColumn(columnKey: nameof(Browser), columnDescription:"浏览器", IsNullable = true)]
    public string Browser { get; set; }

    /// <summary>
    /// 操作系统
    /// </summary>
    [MaxLength(100)]
    [ConfigSugarColumn(columnKey: nameof(Os), columnDescription:"请求地址", IsNullable = true)]
    public string Os { get; set; }

    /// <summary>
    /// 请求地址
    /// </summary>
    [MaxLength(100)]
    [ConfigSugarColumn(columnKey: nameof(Url), columnDescription:"请求地址", IsNullable = true)]
    public string Url { get; set; }

    /// <summary>
    /// 类名称
    /// </summary>
    [MaxLength(100)]
    [ConfigSugarColumn(columnKey: nameof(ClassName), columnDescription:"类名称", IsNullable = true)]
    public string ClassName { get; set; }

    /// <summary>
    /// 方法名称
    /// </summary>
    [MaxLength(100)]
    [ConfigSugarColumn(columnKey: nameof(MethodName), columnDescription:"方法名称", IsNullable = true)]
    public string MethodName { get; set; }

    /// <summary>
    /// 请求方式（GET POST PUT DELETE)
    /// </summary>
    [MaxLength(10)]
    [ConfigSugarColumn(columnKey: nameof(ReqMethod), columnDescription:"请求方式（GET POST PUT DELETE)", IsNullable = true)]
    public string ReqMethod { get; set; }

    /// <summary>
    /// 请求参数
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(Param), columnDescription:"请求参数", IsNullable = true, ColumnDataType = StaticConfig.CodeFirst_BigString)]
    public string Param { get; set; }

    /// <summary>
    /// 返回结果
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(Result), columnDescription:"返回结果", IsNullable = true, ColumnDataType = StaticConfig.CodeFirst_BigString)]
    public string Result { get; set; }

    /// <summary>
    /// 耗时（毫秒）
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(ElapsedTime), columnDescription:"耗时（毫秒）", IsNullable = true)]
    public long ElapsedTime { get; set; }

    /// <summary>
    /// 操作时间
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(OpTime), columnDescription:"操作时间", IsNullable = true)]
    public DateTime OpTime { get; set; }

    /// <summary>
    /// 操作人
    /// </summary>
    [MaxLength(20)]
    [ConfigSugarColumn(columnKey: nameof(Account), columnDescription:"操作人", IsNullable = true)]
    public string Account { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(CreateTime), columnDescription:"创建时间", IsOnlyIgnoreUpdate = true)]
    public virtual DateTime? CreateTime { get; set; }
}

